<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"           
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      >
    <h:head>
        <f:metadata>
            <f:viewParam name="patientID" value="#{userPatientAdminBean.patientID}"/>
            <f:viewParam name="userEmail" value="#{userPatientAdminBean.userEmail}"/>
        </f:metadata>              
    </h:head>
    <h:body>
        <ui:composition template="template/masterlayout.xhtml">
            <ui:define name="pagetitle">
                Add user
            </ui:define>
            <ui:define name="breadcrumb">
                <h:link value="Dashboard" outcome="index"/> &raquo; <h:link value="Patients management" outcome="patient"/> &raquo; Add user
            </ui:define>
            <ui:define name="content">
                <h:form styleClass="jNice">
                    <fieldset>
                        <p>
                            <h:outputLabel for="patientID">Patient ID:</h:outputLabel>                            
                            <h:inputText id="patientID" value="#{userPatientAdminBean.patientID}">
                            </h:inputText>
                            <h:message for="patientID" styleClass="error"/>                            
                        </p>                        
                        <p>
                            <h:outputLabel for="userName">User Name:</h:outputLabel>                            
                            <h:inputText id="userName" value="#{userPatientAdminBean.userName}">
                                <f:validateLength minimum="3" maximum="30"/>
                            </h:inputText>
                            <h:message for="userName" styleClass="error"/>                            
                        </p>
                        <p>
                            <h:outputLabel for="userPass">PassWord:</h:outputLabel>                            
                            <h:inputSecret id="userPass" value="#{userPatientAdminBean.userPass}">
                                <f:validateLength minimum="3" maximum="30"/>
                            </h:inputSecret>
                            <h:message for="userPass" styleClass="error"/>                            
                        </p>
                        <p>
                            <h:outputLabel for="patientEmail">Patient Email:</h:outputLabel>                            
                            <h:inputText id="patientEmail" value="#{userPatientAdminBean.userEmail}">
                                <f:validateLength minimum="3" maximum="30"/>
                                <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]"/>
                            </h:inputText>
                            <h:message for="patientEmail" styleClass="error"/>                            
                        </p>                          
                        <p>
                            <h:commandButton value="Add User" action="#{userPatientAdminBean.addUser()}"/>
                        </p>
                    </fieldset>
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>

